package com.atguigu.demo02.test03;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author gjl
 * @create 2021-04-25 23:42
 */
public class CallableDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {

        /*FutureTask futureTask1 = new FutureTask(new Callable() {
            @Override
            public Object call() throws Exception {
                System.out.println("Callable");
                return "null";
            }
        });*/

        FutureTask futureTask = new FutureTask(()->{ return "null"; });

        Thread thread = new Thread(futureTask,"A");
        thread.start();

        System.out.println(futureTask.get());
    }
}
